export interface ChatCommand {
  id: string;
  name: string;
  handler: string;
}

export const ChatCommands: { [key: string]: ChatCommand } = {
  dynamic_command_index_expand: {
    id: 'dynamic_command_index_expand',
    name: '详细',
    handler: 'remote',
  },
  dynamic_command_index_abbreviation: {
    id: 'dynamic_command_index_abbreviation',
    name: '总结',
    handler: 'remote',
  },
  index_explain: {
    id: 'index_explain',
    name: '解释',
    handler: 'remote',
  },
  index_graphic: {
    id: 'index_graphic',
    name: '图表',
    handler: 'remote',
  },
  index_delete: {
    id: 'index_delete',
    name: '删除',
    handler: 'remote',
  },
  card_edit: {
    id: 'card_edit',
    name: '修改描述',
    handler: 'remote',
  },
  card_index_add: {
    id: 'card_index_add',
    name: '新增指标',
    handler: 'remote',
  },
  card_delete: {
    id: 'card_delete',
    name: '删除卡片',
    handler: 'remote',
  },
  card_analyze: {
    id: 'card_analyze',
    name: '数据解读',
    handler: 'remote',
  },
  card_change: {
    id: 'card_change',
    name: '切换图表',
    handler: 'local',
  },
  visual_insight: {
    id: 'visual_insight',
    name: '图表洞察',
    handler: 'remote'
  },
  close_insight: {
    id: 'close_insight',
    name: '关闭洞察',
    handler: 'local'
  }
}

/**
 * 根据命令id获取命令信息
 * @param commonds 命令id列表
 * @returns 
 */
export function getCommonds(commonds: string[]) {
  return commonds.map((command) => ChatCommands[command])
}